package com.pro.common.service.user.model.db;

import com.pro.common.api.CommonConst;
import com.pro.common.api.model.BaseUserIdModel;
import com.pro.common.service.user.enums.EnumSmsBizType;
import com.pro.framework.javatodb.annotation.JTDTable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Schema(description = "短信验证码")
@JTDTable(sequences = {
        "KEY `idx_phone` (`phone`)",
        "KEY `idx_phone_bizType` (`phone`,`biz_type`)",
}, module = CommonConst.Modules.user, entityId = 20020)
public class UserSmsCode extends BaseUserIdModel {

    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "验证码")
    private String code;

    @Schema(description = "ip")
    private String ip;

    @Schema(description = "业务类型（login、register、resetPassword等）")
    private EnumSmsBizType bizType;

    @Schema(description = "过期时间")
    private LocalDateTime expireTime;

    @Schema(description = "是否已使用（0=未使用，1=已使用,2=已废弃）")
    private Boolean used;


    @Schema(description = "发送时间")
    private LocalDateTime sendTime;

    @Schema(description = "发送状态（0=待发送，1=成功，2=失败）")
    private Integer sendStatus;
}
